package manage.action;

import m.common.action.ActionMeta;
import m.common.action.RequestMeta;
import m.system.util.JSONMessage;
import manage.model.AdminLogin;
import manage.service.AdminSettingService;

@ActionMeta(name="manage/adminSetting")
public class AdminSettingAction extends ManageAction{

    @RequestMeta(params = {"name","value"})
    public JSONMessage setAttr(String name,String value) {
        JSONMessage result=new JSONMessage();
        try {
            AdminLogin admin=getSessionAdmin();
            if(null==admin) throw noLoginException;
            getService(AdminSettingService.class).setAttr(admin.getOid(),name,value);
            fillJSONResult(result,true,"");
        } catch (Exception e) {
            fillJSONResult(result,false,e);
        }
        return result;
    }
}
